package com.wyp168.newcode.face.problem;

import java.lang.reflect.Field;

/**
 * @ClassName AChildObject
 * @Title TODO
 * @Description TODO
 * @Author wyp168
 * @Date 2023/2/5 11:22
 */
public class AChildObject extends AObject{
    public void methodAA() {
        System.out.println(super.methodA());
    }


    public static void main(String[] args) {
        try {
            Class aChildClass = Class.forName("com.wyp168.newcode.face.problem.AChildObject");
            Class aClass = aChildClass.getSuperclass();
            Field message = aClass.getDeclaredField("message");
            //设置修改权限为true，可以修改私有属性值
//            message.setAccessible(true);
            String messageVal = (String) message.get(aClass);
            System.out.println(messageVal);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}
